/**
* @authors Duong NGUYEN <darl2ng@gmail.com>, Anh NGO <ngocanh.ngo@gmail.com>
* @version 0.9
* Copyright 2010
* 
* The MIT License
* Copyright (c) 2010 <Duong NGUYEN <darl2ng@gmail.com>, Anh NGO <ngocanh.ngo@gmail.com>
* 
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* 
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* 
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package {
	import flash.net.SharedObject;

	public final class c	{
		private static var __AppID:String;
		private static var __SO:SharedObject;

		private static var __d1:Boolean=false;
		private static var __d2:Boolean=false;
		
		
		public static function Init(AppID:String):void {
			__AppID = AppID;
			__SO = SharedObject.getLocal(__AppID);
			if (__SO.data.d1 && __SO.data.d1 =="true") {
				__d1 = true;
			}
			if (__SO.data.d2 && __SO.data.d2 =="true") {
				__d2 = true;
			}
		}
		public static function SetD1(b:Boolean):void {
			ifdefault();
			__d1 = b;
			if (__d1) {
				__SO.data.d1 = "true";
			} else {
				__SO.data.d1 = "false";
			}
			__SO.flush();
		}
		public static function SetD2(b:Boolean):void {
			ifdefault();
			__d2 = b;
			if (__d2) {
				__SO.data.d2 = "true";
			} else {
				__SO.data.d2 = "false";
			}
			__SO.flush();
		}
		public static function e(s:String):void {
			trace(__AppID+'[error]: '+s);
		}
		public static function i(s:String):void {
			trace(__AppID+'[info]: ' + s);
		}
		public static function t(s:String):void {
			trace(__AppID+'[todo]: ' + s);
		}		
		public static function d1(s:String):void {			
			ifdefault();
			if (__d1)	trace(__AppID+'[debug1]: ' + s);
		}
		public static function d2(s:String):void {
			ifdefault();
			if (__d2)	trace(__AppID+'[debug2]: ' + s);
		}	
		private static function ifdefault():void {
			if (!__AppID) Init('default');
		}
	}
}